<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
    <title> - 天地维杰网</title>
    <meta name="keywords" content="系统架构,shutdown,不与天斗,Domino,博客,程序员,架构师,笔记,技术,分享,java,Redis">
    
    <meta property="og:title" content="">
    <meta property="og:site_name" content="天地维杰网">
    <meta property="og:image" content="/img/author.jpg"> 
    <meta name="title" content=" - 天地维杰网" />
    <meta name="description" content="天地维杰网 | 博客 | 软件 | 架构 | Java "> 
    <link rel="shortcut icon" href="http://www.shutdown.cn/img/favicon.ico" />
    <link rel="apple-touch-icon" href="http://www.shutdown.cn/img/apple-touch-icon.png" />
    <link rel="apple-touch-icon-precomposed" href="http://www.shutdown.cn/img/apple-touch-icon.png" />
    <link href="http://www.shutdown.cn/js/vendor/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
    <link href="http://www.shutdown.cn/js/vendor/fancybox/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
    <link href="http://www.shutdown.cn/css/main.css" rel="stylesheet" type="text/css" />
    <link href="http://www.shutdown.cn/css/syntax.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
     fancybox: true, 
    motion: true
  };
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7826003325059020" crossorigin="anonymous"></script>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container one-collumn sidebar-position-left page-home  ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"> <div class="site-meta  custom-logo ">

  <div class="custom-logo-site-title">
    <a href="http://www.shutdown.cn"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">天地维杰网</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">人如秋鸿来有信，事若春梦了无痕</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
    <ul id="menu" class="menu">
      
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/redis/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-battery-full"></i> <br />Redis
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/java/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-coffee"></i> <br />java
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/linux/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-linux"></i> <br />linux
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/daily/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-bug"></i> <br />日常问题
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/spring/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-child"></i> <br />Spring和Springboot
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/mac/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-fire"></i> <br />Mac相关
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/middleware/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-gavel"></i> <br />中间件
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/jiagou/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-rocket"></i> <br />架构
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/python/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-ship"></i> <br />python
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/front/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-bolt"></i> <br />前端
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/jvm/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-balance-scale"></i> <br />jvm
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/c/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-battery-empty"></i> <br />c语言
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/categories/web3/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-web3"></i> <br />web3
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/post/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档
          </a>
        </li>
      
        <li class="menu-item ">
          <a href="http://www.shutdown.cn/about/" rel="section">
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于
          </a>
        </li>
      
      <li class="menu-item menu-item-search">
        <a href="javascript:;" class="popup-trigger"> <i class="menu-item-icon fa fa-search fa-fw"></i> <br /> 搜索</a>
      </li>
    </ul>
    <div class="site-search">
      <div class="popup">
 <span class="search-icon fa fa-search"></span>
 <input type="text" id="local-search-input">
 <div id="local-search-result"></div>
 <span class="popup-btn-close">close</span>
</div>

    </div>
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            
<section id="posts" class="posts-expand">
  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <header class="post-header">
      <h1 class="post-title" itemprop="name headline">
        <a class="post-title-link" href="http://www.shutdown.cn/post/redis4.0%E6%96%B0%E7%89%B9%E6%80%A7-memory%E5%91%BD%E4%BB%A4/" itemprop="url">
        
        </a>
      </h1>
      <div class="post-meta">
      <span class="post-time">
<span class="post-meta-item-icon">
    <i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">时间：</span>
<time itemprop="dateCreated" datetime="2016-03-22T13:04:35+08:00" content="0001-01-01">
    0001-01-01
</time>
</span> 
      
      
       <span>
&nbsp; | &nbsp;
<span class="post-meta-item-icon">
    <i class="fa fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读：</span>
<span class="leancloud-visitors-count">1884 字 ~9分钟</span>
</span>
      </div>
    </header>
    <div class="post-body" itemprop="articleBody">
    

    

<h1 id="redis4-0之memory命令详解">redis4.0之MEMORY命令详解</h1>

<h2 id="前言">前言</h2>

<p>在过去，查看redis的内存使用状态只有info memory命令，而且也只有一些基础信息，想要获取全局信息就有些困难。4.0开始redis提供了<code>MEMORY</code>命令，一切都变得简单起来。</p>

<h2 id="memory命令">MEMORY命令</h2>

<p><code>MEMORY</code>命令一共有5个子命令，可以通过<code>MEMORY HELP</code>来查看：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">127.0.0.1:7008&gt; MEMORY HELP
1<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;MEMORY DOCTOR                        - Outputs memory problems report&#34;</span>
2<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;MEMORY USAGE &lt;key&gt; [SAMPLES &lt;count&gt;] - Estimate memory usage of key&#34;</span>
3<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;MEMORY STATS                         - Show memory usage details&#34;</span>
4<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;MEMORY PURGE                         - Ask the allocator to release memory&#34;</span>
5<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;MEMORY MALLOC-STATS                  - Show allocator internal stats&#34;</span></code></pre></div>
<p>接下来我们从<code>MEMORY STATS</code>开始，一一介绍各个子命令的功能。</p>

<h3 id="1-memory-stats">1. MEMORY STATS</h3>

<p>首先，我们需要明确一个概念，redis的内存使用不仅包含所有的key-value数据，还有描述这些key-value的元信息，以及许多管理功能的消耗，比如持久化、主从复制，通过<code>MEMORY STATS</code>可以更好的了解到redis的内存使用状况。</p>

<p>这里我们启动了一个打开持久化功能并且带slave的redis，向其中随机写入了一些数据（某些数据还带有过期时间），以便读者可以更好的了解redis的内存使用，接下来执行<code>MEMORY STATS</code>命令：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">127.0.0.1:7008&gt; MEMORY STATS
 1<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;peak.allocated&#34;</span>
 2<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">14834728</span>
 3<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;total.allocated&#34;</span>
 4<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">14834800</span>
 5<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;startup.allocated&#34;</span>
 6<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">786640</span>
 7<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;replication.backlog&#34;</span>
 8<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">1048576</span>
 9<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;clients.slaves&#34;</span>
10<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">16866</span>
11<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;clients.normal&#34;</span>
12<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">49638</span>
13<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;aof.buffer&#34;</span>
14<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">0</span>
15<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;db.0&#34;</span>
16<span style="color:#ce5c00;font-weight:bold">)</span> 1<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;overhead.hashtable.main&#34;</span>
    2<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">40192</span>
    3<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;overhead.hashtable.expires&#34;</span>
    4<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">0</span>
17<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;overhead.total&#34;</span>
18<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">1941912</span>
19<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;keys.count&#34;</span>
20<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">800</span>
21<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;keys.bytes-per-key&#34;</span>
22<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">17560</span>
23<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;dataset.bytes&#34;</span>
24<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">12892888</span>
25<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;dataset.percentage&#34;</span>
26<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;91.776351928710938&#34;</span>
27<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;peak.percentage&#34;</span>
28<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;100.00048828125&#34;</span>
29<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;fragmentation&#34;</span>
30<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#4e9a06">&#34;1.6665706634521484&#34;</span></code></pre></div>
<p>一共有15项内容，内存使用量均以字节为单位，我们一个一个来看：</p>

<h4 id="1-peak-allocated">1. peak.allocated</h4>

<ul>
<li>redis启动到现在，最多使用过多少内存(即峰值内存量)。</li>
</ul>

<h4 id="2-total-allocated">2. total.allocated</h4>

<ul>
<li>当前使用的内存总量。</li>
</ul>

<h4 id="3-startup-allocated">3. startup.allocated</h4>

<ul>
<li>redis启动初始化时使用的内存，有很多读者会比较奇怪，为什么我的redis启动以后什么都没做就已经占用了几十MB的内存？</li>
<li>这是因为redis本身不仅存储key-value，还有其他的内存消耗，比如共享变量、主从复制、持久化和db元信息，下面各项会有详细介绍。</li>
</ul>

<h4 id="4-replication-backlog">4. replication.backlog</h4>

<ul>
<li>主从复制backlog使用的内存，默认10MB，backlog只在主从断线重连时发挥作用，主从复制本身并不依赖此项。</li>
</ul>

<h4 id="5-clients-slaves">5. clients.slaves</h4>

<p>主从复制中所有slave的读写缓冲区，包括output-buffer（也即输出缓冲区）使用的内存和querybuf（也即输入缓冲区），这里简单介绍一下主从复制：</p>

<ul>
<li>redis把一次事件循环中，所有对数据库发生更改的内容先追加到slave的output-buffer中，在事件循环结束后统一发送给slave。</li>
<li>那么主从之间就难免会有数据的延迟，如果主从之间连接断开，重连时为了保证数据的一致性就要做一次全量同步，这显然是不够高效的。backlog就是为此而设计，master在backlog中缓存一部分主从复制的增量数据，断线重连时如果slave的偏移量在backlog中，那就可以只把偏移量之后的增量数据同步给slave即可，避免了全量同步的开销。</li>
</ul>

<h4 id="6-clients-normal">6. clients.normal</h4>

<ul>
<li>除slave外所有其他客户端的读写缓冲区。</li>
<li>有时候一些客户端读取不及时，就会造成output-buffer积压占用内存过多的情况，可以通过配置项client-output-buffer-limit来限制，当超过阈值之后redis就会主动断开连接以释放内存，slave亦是如此。</li>
</ul>

<h4 id="7-aof-buffer">7. aof.buffer</h4>

<p>此项为aof持久化使用的缓存和aofrewrite时产生的缓存之和，当然如果关闭了appendonly那这项就一直为0：</p>

<ul>
<li>redis并不是在有写入时就立即做持久化的，而是在一次事件循环内把所有的写入数据缓存，待到事件循环结束后再持久化到磁盘。</li>
<li>aofrewrite时缓存增量数据使用的内存，只在aofrewrite时才会使用，aofrewrite机制可以参考之前的文章<a href="https://yq.aliyun.com/articles/177819?spm=5176.8091938.0.0.T3D8Bq">《redis4.0之利用管道优化aofrewrite》</a>。</li>
</ul>

<p>可以看出这一项的大小与写入流量成正比。</p>

<h4 id="8-db-0">8. db.0</h4>

<p>redis每个db的元信息使用的内存，这里只使用了db0，所以只打印了db0的内存使用状态，当使用其他db时也会有相应的信息。 db的元信息有以下三项：</p>

<ul>
<li><p>a) redis的db就是一张hash表，首先就是这张hash表使用的内存（redis使用链式hash，hash表中存放所有链表的头指针）；</p></li>

<li><p>b) 每一个key-value对都有一个<code>dictEntry</code>来记录他们的关系，元信息便包含该db中所有<code>dictEntry</code>使用的内存；</p></li>

<li><p>c) redis使用<code>redisObject</code>来描述value所对应的不同数据类型（string、list、hash、set、zset），那么<code>redisObject</code>占用的空间也计算在元信息中。</p></li>
</ul>

<ol>
<li><p>overhead.hashtable.main：
db的元信息也即是以上三项之和，计算公式为：
&gt; hashtable + <code>dictEntry</code> + <code>redisObject</code></p></li>

<li><p>overhead.hashtable.expires:</p>

<p>对于key的过期时间，redis并没有把它和value放在一起，而是单独用一个hashtable来存储，但是expires这张hash表记录的是key-expire信息，所以不需要<code>redisObject</code>来描述value，其元信息也就少了一项，计算公式为：
&gt; hashtable + <code>dictEntry</code></p></li>
</ol>

<h4 id="9-overhead-total">9. overhead.total</h4>

<p>3-8项之和：startup.allocated+replication.backlog+clients.slaves+clients.normal+aof.buffer+dbx</p>

<h4 id="10-dataset-bytes">10. dataset.bytes</h4>

<p>所有数据所使用的内存——也即total.allocated - overhead.total——当前内存使用量减去管理类内存使用量。</p>

<h4 id="11-dataset-percentage">11. dataset.percentage</h4>

<p>所有数据占比，这里并没有直接使用total.allocated做分母，而是除去了redis启动初始化的内存，计算公式为：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">    100 * dataset.bytes / (total.allocated - startup.allocated)</code></pre></div>
<h4 id="12-keys-count">12. keys.count</h4>

<p>redis当前存储的key总量</p>

<h4 id="13-keys-bytes-per-key">13. keys.bytes-per-key</h4>

<p>平均每个key的内存大小，直觉上应该是用dataset.bytes除以keys.count即可，但是redis并没有这么做，而是把管理类内存也平摊到了每个key的内存使用中，计算公式为：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">    (total.allocated - startup.allocated) / keys.count</code></pre></div>
<h4 id="14-peak-percentage">14. peak.percentage</h4>

<p>当前使用内存与历史最高值比例</p>

<h4 id="15-fragmentation">15. fragmentation</h4>

<p>内存碎片率</p>

<h3 id="2-memory-usage">2. MEMORY USAGE</h3>

<p>相信所有redis用户都希望对每一个key-value的内存使用了如指掌，然而4.0之前redis并没有提供一个明确的方法来进行内存评估，不过从4.0开始，MEMORY命令实现了这一功能。</p>

<p>首先看下使用方法：MEMORY usage [samples count]</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">127.0.0.1:7007&gt; MEMORY USAGE dr:hello_biglist_00000011 samples <span style="color:#0000cf;font-weight:bold">0</span>
<span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">3065</span>
127.0.0.1:7007&gt; MEMORY USAGE dr:hello_biglist_00000011 samples <span style="color:#0000cf;font-weight:bold">0</span>
<span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">3065</span>
127.0.0.1:7007&gt; MEMORY USAGE dr:hello_biglist_00000011 samples <span style="color:#0000cf;font-weight:bold">5</span>
<span style="color:#ce5c00;font-weight:bold">(</span>integer<span style="color:#ce5c00;font-weight:bold">)</span> <span style="color:#0000cf;font-weight:bold">3065</span></code></pre></div>
<p>命令参数不多，通过字面意思也可以看出来是评估指定key的内存使用情况。samples样本数是可选参数，默认为5，如果给0会计算全部样本数。以hash为例看下其如果工作：</p>

<ol>
<li>首先类似于上一节中的overhead.hashtable.main，要计算hash的元信息内存，包括hash表的大小以及所有<code>dictEntry</code>的内存占用信息。</li>
<li>与overhead.hashtable.main不同的是，每个<code>dictEntry</code>中key-value都是字符串，所以没<code>redisObject</code>的额外消耗。在评估真正的数据内存大小时redis并没有去遍历所有key，而是采用的抽样估算：随机抽取samples个key-value对计算其平均内存占用，再乘以key-value对的个数即得到结果。试想一下如果要精确计算内存占用，那么就需要遍历所有的元素，当元素很多时就是使redis阻塞，所以请合理设置samples的大小。其他数据结构的计算方式类似于hash，此处就不再赘述。</li>
</ol>

<h3 id="3-memory-doctor">3. MEMORY DOCTOR</h3>

<p>此项子命令是作者给出的关于redis内存使用方面的建议，在不同的允许状态下会有不同的分析结果：</p>

<h4 id="首先是没问题的情况">首先是没问题的情况</h4>

<ul>
<li><p>运行状态良好：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">Hi Sam, I can&#39;t find any memory issue in your instance.
I can only account for what occurs on this base.</code></pre></div></li>

<li><p>redis的数据量很小，暂无建议：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">Hi Sam, this instance is empty or is using very little memory, 
my issues detector can&#39;t be used in these conditions. Please, 
leave for your mission on Earth and fill it with some data. The 
new Sam and I will be back to our programming as soon as I 
finished rebooting.</code></pre></div></li>
</ul>

<h4 id="接下来出现的结果就需要注意了">接下来出现的结果就需要注意了</h4>

<ul>
<li><p>内存使用峰值1.5倍于目前内存使用量，此时内存碎片率可能会比较高，需要注意：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">Peak memory: In the past this instance used more than 150% the 
memory that is currently using. The allocator is normally not 
able to release memory after a peak, so you can expect to see a 
big fragmentation ratio, however this is actually harmless and 
is only due to the memory peak, and if the Redis instance 
Resident Set Size (RSS) is currently bigger than expected, the 
memory will be used as soon as you fill the Redis instance with 
more data. If the memory peak was only occasional and you want 
to try to reclaim memory, please try the MEMORY PURGE command, 
otherwise the only other option is to shutdown and restart the 
instance.</code></pre></div></li>

<li><p>内存碎片率过高超过1.4，需要注意：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">High fragmentation: This instance has a memory fragmentation 
greater than 1.4 (this means that the Resident Set Size of the 
Redis process is much larger than the sum of the logical 
allocations Redis performed). This problem is usually due either 
to a large peak memory (check if there is a peak memory entry 
above in the report) or may result from a workload that causes 
the allocator to fragment memory a lot. If the problem is a 
large peak memory, then there is no issue. Otherwise, make sure 
you are using the Jemalloc allocator and not the default libc 
malloc.</code></pre></div></li>

<li><p>每个slave缓冲区的平均内存超过10MB，原因可能是master写入流量过高，也有可能是主从同步的网络带宽不足或者slave处理较慢：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">Big slave buffers: The slave output buffers in this instance are 
greater than 10MB for each slave (on average). This likely means 
that there is some slave instance that is struggling receiving 
data, either because it is too slow or because of networking 
issues. As a result, data piles on the master output buffers. 
Please try to identify what slave is not receiving data 
correctly and why. You can use the INFO output in order to check 
the slaves delays and the CLIENT LIST command to check the 
output buffers of each slave.</code></pre></div></li>

<li><p>普通客户端缓冲区的平均内存超过200KB，原因可能是pipeline使用不当或者Pub/Sub客户端处理消息不及时导致：</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-fallback" data-lang="fallback">Big client buffers: The clients output buffers in this instance 
are greater than 200K per client (on average). This may result 
from different causes, like Pub/Sub clients subscribed to 
channels bot not receiving data fast enough, so that data piles 
on the Redis instance output buffer, or clients sending commands 
with large replies or very large sequences of commands in the 
same pipeline. Please use the CLIENT LIST command in order to 
investigate the issue if it causes problems in your instance, or 
to understand better why certain clients are using a big amount 
of memory.</code></pre></div></li>
</ul>

<p>具体有哪些返回，可以查看源码的<a href="https://github.com/redis/redis/blob/4.0/src/object.c">object.c</a>文件中有具体实现。5.0版本相较于4.0版本，还增加了一些其他的诊断结果。</p>

<ul>
<li><p>分配器外部碎片率高于1.1</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">High allocator fragmentation: This instance has an allocator 
external fragmentation greater than 1.1. This problem is 
usually due either to a large peak memory (check if there is a 
peak memory entry above in the report) or may result from a 
workload that causes the allocator to fragment memory a lot. 
You can try enabling &#39;activedefrag&#39; config option.</code></pre></div></li>

<li><p>实例分配器内存开销比率大于1.1</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">High allocator RSS overhead: This instance has an RSS memory 
overhead is greater than 1.1 (this means that the Resident Set 
Size of the allocator is much larger than the sum what the 
allocator actually holds). This problem is usually due to a 
large peak memory (check if there is a peak memory entry above 
in the report), you can try the MEMORY PURGE command to 
reclaim it.</code></pre></div></li>

<li><p>进程内存比率大于1.1</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">High process RSS overhead: This instance has non-allocator RSS 
memory overhead is greater than 1.1 (this means that the 
Resident Set Size of the Redis process is much larger than the 
RSS the allocator holds). This problem may be due to Lua 
scripts or Modules.</code></pre></div></li>

<li><p>缓存脚本超过1000个</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-text" data-lang="text">Many scripts: There seem to be many cached scripts in this 
instance (more than 1000). This may be because scripts are 
generated and `EVAL`ed, instead of being parameterized (with 
KEYS and ARGV), `SCRIPT LOAD`ed and `EVALSHA`ed. Unless 
`SCRIPT FLUSH` is called periodically, the scripts&#39; caches may 
end up consuming most of your memory.</code></pre></div></li>
</ul>

<h3 id="4-memory-malloc-stats">4. MEMORY MALLOC-STATS</h3>

<p>打印内存分配器状态，只在使用jemalloc时有用。</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">127.0.0.1:7008&gt; MEMORY MALLOC-STATS
___ Begin jemalloc statistics ___
Version: 4.0.3-0-ge9192eacf8935e29fc62fddc2701f7942b1cc02c
Assertions disabled
Run-time option settings:
  opt.abort: <span style="color:#204a87">false</span>
  opt.lg_chunk: <span style="color:#0000cf;font-weight:bold">21</span>
  opt.dss: <span style="color:#4e9a06">&#34;secondary&#34;</span>
  opt.narenas: <span style="color:#0000cf;font-weight:bold">1</span>
  opt.lg_dirty_mult: <span style="color:#0000cf;font-weight:bold">3</span> <span style="color:#ce5c00;font-weight:bold">(</span>arenas.lg_dirty_mult: 3<span style="color:#ce5c00;font-weight:bold">)</span>
  opt.stats_print: <span style="color:#204a87">false</span>
  opt.junk: <span style="color:#4e9a06">&#34;false&#34;</span>
  opt.quarantine: <span style="color:#0000cf;font-weight:bold">0</span>
  opt.redzone: <span style="color:#204a87">false</span>
  opt.zero: <span style="color:#204a87">false</span>
  opt.tcache: <span style="color:#204a87">true</span>
  opt.lg_tcache_max: <span style="color:#0000cf;font-weight:bold">15</span>
CPUs: <span style="color:#0000cf;font-weight:bold">1</span>
Arenas: <span style="color:#0000cf;font-weight:bold">1</span>
Pointer size: <span style="color:#0000cf;font-weight:bold">8</span>
Quantum size: <span style="color:#0000cf;font-weight:bold">8</span>
Page size: <span style="color:#0000cf;font-weight:bold">4096</span>
Min active:dirty page ratio per arena: 8:1
Maximum thread-cached size class: <span style="color:#0000cf;font-weight:bold">32768</span>
Chunk size: <span style="color:#0000cf;font-weight:bold">2097152</span> <span style="color:#ce5c00;font-weight:bold">(</span>2^21<span style="color:#ce5c00;font-weight:bold">)</span>
Allocated: 14885856, active: 16277504, metadata: 1614792, resident: 18382848, mapped: <span style="color:#0000cf;font-weight:bold">20971520</span>
Current active ceiling: <span style="color:#0000cf;font-weight:bold">16777216</span>

arenas<span style="color:#ce5c00;font-weight:bold">[</span>0<span style="color:#ce5c00;font-weight:bold">]</span>:
assigned threads: <span style="color:#0000cf;font-weight:bold">1</span>
dss allocation precedence: secondary
min active:dirty page ratio: 8:1
dirty pages: 3974:132 active:dirty, <span style="color:#0000cf;font-weight:bold">0</span> sweeps, <span style="color:#0000cf;font-weight:bold">0</span> madvises, <span style="color:#0000cf;font-weight:bold">0</span> purged
                            allocated      nmalloc      ndalloc    nrequests
small:                        <span style="color:#0000cf;font-weight:bold">9864160</span>      <span style="color:#0000cf;font-weight:bold">1870748</span>      <span style="color:#0000cf;font-weight:bold">1343297</span>      <span style="color:#0000cf;font-weight:bold">2255398</span>
large:                        <span style="color:#0000cf;font-weight:bold">5021696</span>         <span style="color:#0000cf;font-weight:bold">7938</span>         <span style="color:#0000cf;font-weight:bold">7728</span>         <span style="color:#0000cf;font-weight:bold">7939</span>
huge:                               <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>
total:                       <span style="color:#0000cf;font-weight:bold">14885856</span>      <span style="color:#0000cf;font-weight:bold">1878686</span>      <span style="color:#0000cf;font-weight:bold">1351025</span>      <span style="color:#0000cf;font-weight:bold">2263337</span>
active:                      <span style="color:#0000cf;font-weight:bold">16277504</span>
mapped:                      <span style="color:#0000cf;font-weight:bold">18874368</span>
metadata: mapped: 479232, allocated: <span style="color:#0000cf;font-weight:bold">50952</span>
bins:           size ind    allocated      nmalloc      ndalloc    nrequests      curregs      curruns regs pgs  util       nfills     nflushes      newruns       reruns
                   <span style="color:#0000cf;font-weight:bold">8</span>   <span style="color:#0000cf;font-weight:bold">0</span>      <span style="color:#0000cf;font-weight:bold">2461920</span>       <span style="color:#0000cf;font-weight:bold">308470</span>          <span style="color:#0000cf;font-weight:bold">730</span>       <span style="color:#0000cf;font-weight:bold">310415</span>       <span style="color:#0000cf;font-weight:bold">307740</span>          <span style="color:#0000cf;font-weight:bold">602</span>  <span style="color:#0000cf;font-weight:bold">512</span>   <span style="color:#0000cf;font-weight:bold">1</span> 0.998        <span style="color:#0000cf;font-weight:bold">45268</span>          <span style="color:#0000cf;font-weight:bold">197</span>          <span style="color:#0000cf;font-weight:bold">603</span>           <span style="color:#0000cf;font-weight:bold">91</span>
                  <span style="color:#0000cf;font-weight:bold">16</span>   <span style="color:#0000cf;font-weight:bold">1</span>       <span style="color:#0000cf;font-weight:bold">176240</span>        <span style="color:#0000cf;font-weight:bold">11763</span>          <span style="color:#0000cf;font-weight:bold">748</span>        <span style="color:#0000cf;font-weight:bold">12136</span>        <span style="color:#0000cf;font-weight:bold">11015</span>           <span style="color:#0000cf;font-weight:bold">44</span>  <span style="color:#0000cf;font-weight:bold">256</span>   <span style="color:#0000cf;font-weight:bold">1</span> 0.977          <span style="color:#0000cf;font-weight:bold">305</span>          <span style="color:#0000cf;font-weight:bold">130</span>           <span style="color:#0000cf;font-weight:bold">46</span>            <span style="color:#0000cf;font-weight:bold">2</span>
                  <span style="color:#0000cf;font-weight:bold">24</span>   <span style="color:#0000cf;font-weight:bold">2</span>      <span style="color:#0000cf;font-weight:bold">4960704</span>       <span style="color:#0000cf;font-weight:bold">719462</span>       <span style="color:#0000cf;font-weight:bold">512766</span>       <span style="color:#0000cf;font-weight:bold">955290</span>       <span style="color:#0000cf;font-weight:bold">206696</span>          <span style="color:#0000cf;font-weight:bold">414</span>  <span style="color:#0000cf;font-weight:bold">512</span>   <span style="color:#0000cf;font-weight:bold">3</span> 0.975         <span style="color:#0000cf;font-weight:bold">8173</span>         <span style="color:#0000cf;font-weight:bold">5145</span>          <span style="color:#0000cf;font-weight:bold">458</span>         <span style="color:#0000cf;font-weight:bold">2210</span>
                  <span style="color:#0000cf;font-weight:bold">32</span>   <span style="color:#0000cf;font-weight:bold">3</span>        <span style="color:#0000cf;font-weight:bold">25792</span>       <span style="color:#0000cf;font-weight:bold">516628</span>       <span style="color:#0000cf;font-weight:bold">515822</span>       <span style="color:#0000cf;font-weight:bold">643427</span>          <span style="color:#0000cf;font-weight:bold">806</span>           <span style="color:#0000cf;font-weight:bold">48</span>  <span style="color:#0000cf;font-weight:bold">128</span>   <span style="color:#0000cf;font-weight:bold">1</span> 0.131         <span style="color:#0000cf;font-weight:bold">6693</span>         <span style="color:#0000cf;font-weight:bold">5221</span>          <span style="color:#0000cf;font-weight:bold">628</span>         <span style="color:#0000cf;font-weight:bold">3953</span>
                  <span style="color:#0000cf;font-weight:bold">40</span>   <span style="color:#0000cf;font-weight:bold">4</span>         <span style="color:#0000cf;font-weight:bold">8320</span>          <span style="color:#0000cf;font-weight:bold">583</span>          <span style="color:#0000cf;font-weight:bold">375</span>          <span style="color:#0000cf;font-weight:bold">913</span>          <span style="color:#0000cf;font-weight:bold">208</span>            <span style="color:#0000cf;font-weight:bold">1</span>  <span style="color:#0000cf;font-weight:bold">512</span>   <span style="color:#0000cf;font-weight:bold">5</span> 0.406          <span style="color:#0000cf;font-weight:bold">163</span>          <span style="color:#0000cf;font-weight:bold">166</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                  <span style="color:#0000cf;font-weight:bold">48</span>   <span style="color:#0000cf;font-weight:bold">5</span>         <span style="color:#0000cf;font-weight:bold">1728</span>       <span style="color:#0000cf;font-weight:bold">304732</span>       <span style="color:#0000cf;font-weight:bold">304696</span>       <span style="color:#0000cf;font-weight:bold">319752</span>           <span style="color:#0000cf;font-weight:bold">36</span>            <span style="color:#0000cf;font-weight:bold">2</span>  <span style="color:#0000cf;font-weight:bold">256</span>   <span style="color:#0000cf;font-weight:bold">3</span> 0.070         <span style="color:#0000cf;font-weight:bold">4602</span>         <span style="color:#0000cf;font-weight:bold">3105</span>         <span style="color:#0000cf;font-weight:bold">1011</span>          <span style="color:#0000cf;font-weight:bold">384</span>
                  <span style="color:#0000cf;font-weight:bold">56</span>   <span style="color:#0000cf;font-weight:bold">6</span>          <span style="color:#0000cf;font-weight:bold">896</span>          <span style="color:#0000cf;font-weight:bold">333</span>          <span style="color:#0000cf;font-weight:bold">317</span>          <span style="color:#0000cf;font-weight:bold">471</span>           <span style="color:#0000cf;font-weight:bold">16</span>            <span style="color:#0000cf;font-weight:bold">1</span>  <span style="color:#0000cf;font-weight:bold">512</span>   <span style="color:#0000cf;font-weight:bold">7</span> 0.031          <span style="color:#0000cf;font-weight:bold">104</span>          <span style="color:#0000cf;font-weight:bold">107</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                  <span style="color:#0000cf;font-weight:bold">64</span>   <span style="color:#0000cf;font-weight:bold">7</span>          <span style="color:#0000cf;font-weight:bold">192</span>          <span style="color:#0000cf;font-weight:bold">217</span>          <span style="color:#0000cf;font-weight:bold">214</span>          <span style="color:#0000cf;font-weight:bold">704</span>            <span style="color:#0000cf;font-weight:bold">3</span>            <span style="color:#0000cf;font-weight:bold">1</span>   <span style="color:#0000cf;font-weight:bold">64</span>   <span style="color:#0000cf;font-weight:bold">1</span> 0.046          <span style="color:#0000cf;font-weight:bold">116</span>          <span style="color:#0000cf;font-weight:bold">108</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                  <span style="color:#0000cf;font-weight:bold">80</span>   <span style="color:#0000cf;font-weight:bold">8</span>          <span style="color:#0000cf;font-weight:bold">240</span>          <span style="color:#0000cf;font-weight:bold">388</span>          <span style="color:#0000cf;font-weight:bold">385</span>          <span style="color:#0000cf;font-weight:bold">599</span>            <span style="color:#0000cf;font-weight:bold">3</span>            <span style="color:#0000cf;font-weight:bold">1</span>  <span style="color:#0000cf;font-weight:bold">256</span>   <span style="color:#0000cf;font-weight:bold">5</span> 0.011          <span style="color:#0000cf;font-weight:bold">217</span>          <span style="color:#0000cf;font-weight:bold">189</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                  <span style="color:#0000cf;font-weight:bold">96</span>   <span style="color:#0000cf;font-weight:bold">9</span>        <span style="color:#0000cf;font-weight:bold">38304</span>         <span style="color:#0000cf;font-weight:bold">1036</span>          <span style="color:#0000cf;font-weight:bold">637</span>         <span style="color:#0000cf;font-weight:bold">1103</span>          <span style="color:#0000cf;font-weight:bold">399</span>            <span style="color:#0000cf;font-weight:bold">4</span>  <span style="color:#0000cf;font-weight:bold">128</span>   <span style="color:#0000cf;font-weight:bold">3</span> 0.779          <span style="color:#0000cf;font-weight:bold">202</span>          <span style="color:#0000cf;font-weight:bold">189</span>            <span style="color:#0000cf;font-weight:bold">7</span>           <span style="color:#0000cf;font-weight:bold">12</span>
                 <span style="color:#0000cf;font-weight:bold">112</span>  <span style="color:#0000cf;font-weight:bold">10</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">454</span>          <span style="color:#0000cf;font-weight:bold">454</span>          <span style="color:#0000cf;font-weight:bold">401</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>  <span style="color:#0000cf;font-weight:bold">256</span>   <span style="color:#0000cf;font-weight:bold">7</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">118</span>          <span style="color:#0000cf;font-weight:bold">107</span>          <span style="color:#0000cf;font-weight:bold">101</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">128</span>  <span style="color:#0000cf;font-weight:bold">11</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">281</span>          <span style="color:#0000cf;font-weight:bold">281</span>          <span style="color:#0000cf;font-weight:bold">674</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>   <span style="color:#0000cf;font-weight:bold">32</span>   <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">214</span>          <span style="color:#0000cf;font-weight:bold">187</span>          <span style="color:#0000cf;font-weight:bold">181</span>            <span style="color:#0000cf;font-weight:bold">2</span>
                 <span style="color:#0000cf;font-weight:bold">160</span>  <span style="color:#0000cf;font-weight:bold">12</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">287</span>          <span style="color:#0000cf;font-weight:bold">287</span>          <span style="color:#0000cf;font-weight:bold">411</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>  <span style="color:#0000cf;font-weight:bold">128</span>   <span style="color:#0000cf;font-weight:bold">5</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">184</span>          <span style="color:#0000cf;font-weight:bold">186</span>          <span style="color:#0000cf;font-weight:bold">180</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">192</span>  <span style="color:#0000cf;font-weight:bold">13</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">246</span>          <span style="color:#0000cf;font-weight:bold">246</span>          <span style="color:#0000cf;font-weight:bold">429</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>   <span style="color:#0000cf;font-weight:bold">64</span>   <span style="color:#0000cf;font-weight:bold">3</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">171</span>          <span style="color:#0000cf;font-weight:bold">176</span>          <span style="color:#0000cf;font-weight:bold">171</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">224</span>  <span style="color:#0000cf;font-weight:bold">14</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">284</span>          <span style="color:#0000cf;font-weight:bold">284</span>          <span style="color:#0000cf;font-weight:bold">601</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>  <span style="color:#0000cf;font-weight:bold">128</span>   <span style="color:#0000cf;font-weight:bold">7</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">183</span>          <span style="color:#0000cf;font-weight:bold">178</span>           <span style="color:#0000cf;font-weight:bold">12</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">256</span>  <span style="color:#0000cf;font-weight:bold">15</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">197</span>          <span style="color:#0000cf;font-weight:bold">197</span>          <span style="color:#0000cf;font-weight:bold">605</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>   <span style="color:#0000cf;font-weight:bold">16</span>   <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">175</span>          <span style="color:#0000cf;font-weight:bold">178</span>          <span style="color:#0000cf;font-weight:bold">173</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">320</span>  <span style="color:#0000cf;font-weight:bold">16</span>         <span style="color:#0000cf;font-weight:bold">5120</span>          <span style="color:#0000cf;font-weight:bold">252</span>          <span style="color:#0000cf;font-weight:bold">236</span>          <span style="color:#0000cf;font-weight:bold">416</span>           <span style="color:#0000cf;font-weight:bold">16</span>            <span style="color:#0000cf;font-weight:bold">1</span>   <span style="color:#0000cf;font-weight:bold">64</span>   <span style="color:#0000cf;font-weight:bold">5</span> 0.250          <span style="color:#0000cf;font-weight:bold">184</span>          <span style="color:#0000cf;font-weight:bold">189</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">384</span>  <span style="color:#0000cf;font-weight:bold">17</span>          <span style="color:#0000cf;font-weight:bold">384</span>          <span style="color:#0000cf;font-weight:bold">195</span>          <span style="color:#0000cf;font-weight:bold">194</span>          <span style="color:#0000cf;font-weight:bold">427</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">1</span>   <span style="color:#0000cf;font-weight:bold">32</span>   <span style="color:#0000cf;font-weight:bold">3</span> 0.031          <span style="color:#0000cf;font-weight:bold">158</span>          <span style="color:#0000cf;font-weight:bold">162</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">448</span>  <span style="color:#0000cf;font-weight:bold">18</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">246</span>          <span style="color:#0000cf;font-weight:bold">246</span>          <span style="color:#0000cf;font-weight:bold">401</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>   <span style="color:#0000cf;font-weight:bold">64</span>   <span style="color:#0000cf;font-weight:bold">7</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">178</span>          <span style="color:#0000cf;font-weight:bold">183</span>          <span style="color:#0000cf;font-weight:bold">178</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">512</span>  <span style="color:#0000cf;font-weight:bold">19</span>          <span style="color:#0000cf;font-weight:bold">512</span>          <span style="color:#0000cf;font-weight:bold">189</span>          <span style="color:#0000cf;font-weight:bold">188</span>          <span style="color:#0000cf;font-weight:bold">605</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">1</span>    <span style="color:#0000cf;font-weight:bold">8</span>   <span style="color:#0000cf;font-weight:bold">1</span> 0.125          <span style="color:#0000cf;font-weight:bold">180</span>          <span style="color:#0000cf;font-weight:bold">182</span>            <span style="color:#0000cf;font-weight:bold">2</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                 <span style="color:#0000cf;font-weight:bold">640</span>  <span style="color:#0000cf;font-weight:bold">20</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">214</span>          <span style="color:#0000cf;font-weight:bold">214</span>          <span style="color:#0000cf;font-weight:bold">401</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>   <span style="color:#0000cf;font-weight:bold">32</span>   <span style="color:#0000cf;font-weight:bold">5</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">179</span>          <span style="color:#0000cf;font-weight:bold">183</span>          <span style="color:#0000cf;font-weight:bold">179</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                 <span style="color:#0000cf;font-weight:bold">768</span>  <span style="color:#0000cf;font-weight:bold">21</span>        <span style="color:#0000cf;font-weight:bold">76800</span>          <span style="color:#0000cf;font-weight:bold">372</span>          <span style="color:#0000cf;font-weight:bold">272</span>          <span style="color:#0000cf;font-weight:bold">400</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">7</span>   <span style="color:#0000cf;font-weight:bold">16</span>   <span style="color:#0000cf;font-weight:bold">3</span> 0.892          <span style="color:#0000cf;font-weight:bold">179</span>          <span style="color:#0000cf;font-weight:bold">181</span>           <span style="color:#0000cf;font-weight:bold">23</span>            <span style="color:#0000cf;font-weight:bold">5</span>
                 <span style="color:#0000cf;font-weight:bold">896</span>  <span style="color:#0000cf;font-weight:bold">22</span>         <span style="color:#0000cf;font-weight:bold">2688</span>          <span style="color:#0000cf;font-weight:bold">216</span>          <span style="color:#0000cf;font-weight:bold">213</span>          <span style="color:#0000cf;font-weight:bold">303</span>            <span style="color:#0000cf;font-weight:bold">3</span>            <span style="color:#0000cf;font-weight:bold">2</span>   <span style="color:#0000cf;font-weight:bold">32</span>   <span style="color:#0000cf;font-weight:bold">7</span> 0.046          <span style="color:#0000cf;font-weight:bold">179</span>          <span style="color:#0000cf;font-weight:bold">183</span>            <span style="color:#0000cf;font-weight:bold">2</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                <span style="color:#0000cf;font-weight:bold">1024</span>  <span style="color:#0000cf;font-weight:bold">23</span>         <span style="color:#0000cf;font-weight:bold">2048</span>          <span style="color:#0000cf;font-weight:bold">190</span>          <span style="color:#0000cf;font-weight:bold">188</span>          <span style="color:#0000cf;font-weight:bold">504</span>            <span style="color:#0000cf;font-weight:bold">2</span>            <span style="color:#0000cf;font-weight:bold">1</span>    <span style="color:#0000cf;font-weight:bold">4</span>   <span style="color:#0000cf;font-weight:bold">1</span> 0.500          <span style="color:#0000cf;font-weight:bold">181</span>          <span style="color:#0000cf;font-weight:bold">182</span>            <span style="color:#0000cf;font-weight:bold">3</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                <span style="color:#0000cf;font-weight:bold">1280</span>  <span style="color:#0000cf;font-weight:bold">24</span>       <span style="color:#0000cf;font-weight:bold">128000</span>          <span style="color:#0000cf;font-weight:bold">412</span>          <span style="color:#0000cf;font-weight:bold">312</span>          <span style="color:#0000cf;font-weight:bold">401</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">7</span>   <span style="color:#0000cf;font-weight:bold">16</span>   <span style="color:#0000cf;font-weight:bold">5</span> 0.892          <span style="color:#0000cf;font-weight:bold">199</span>          <span style="color:#0000cf;font-weight:bold">201</span>           <span style="color:#0000cf;font-weight:bold">27</span>            <span style="color:#0000cf;font-weight:bold">8</span>
                <span style="color:#0000cf;font-weight:bold">1536</span>  <span style="color:#0000cf;font-weight:bold">25</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">207</span>          <span style="color:#0000cf;font-weight:bold">207</span>          <span style="color:#0000cf;font-weight:bold">301</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>    <span style="color:#0000cf;font-weight:bold">8</span>   <span style="color:#0000cf;font-weight:bold">3</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">198</span>          <span style="color:#0000cf;font-weight:bold">200</span>          <span style="color:#0000cf;font-weight:bold">199</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                <span style="color:#0000cf;font-weight:bold">1792</span>  <span style="color:#0000cf;font-weight:bold">26</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">208</span>          <span style="color:#0000cf;font-weight:bold">208</span>          <span style="color:#0000cf;font-weight:bold">300</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>   <span style="color:#0000cf;font-weight:bold">16</span>   <span style="color:#0000cf;font-weight:bold">7</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">187</span>          <span style="color:#0000cf;font-weight:bold">190</span>          <span style="color:#0000cf;font-weight:bold">187</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                <span style="color:#0000cf;font-weight:bold">2048</span>  <span style="color:#0000cf;font-weight:bold">27</span>         <span style="color:#0000cf;font-weight:bold">4096</span>          <span style="color:#0000cf;font-weight:bold">172</span>          <span style="color:#0000cf;font-weight:bold">170</span>          <span style="color:#0000cf;font-weight:bold">503</span>            <span style="color:#0000cf;font-weight:bold">2</span>            <span style="color:#0000cf;font-weight:bold">1</span>    <span style="color:#0000cf;font-weight:bold">2</span>   <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">163</span>          <span style="color:#0000cf;font-weight:bold">165</span>          <span style="color:#0000cf;font-weight:bold">140</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                <span style="color:#0000cf;font-weight:bold">2560</span>  <span style="color:#0000cf;font-weight:bold">28</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">188</span>          <span style="color:#0000cf;font-weight:bold">188</span>          <span style="color:#0000cf;font-weight:bold">300</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>    <span style="color:#0000cf;font-weight:bold">8</span>   <span style="color:#0000cf;font-weight:bold">5</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">179</span>          <span style="color:#0000cf;font-weight:bold">181</span>          <span style="color:#0000cf;font-weight:bold">180</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                <span style="color:#0000cf;font-weight:bold">3072</span>  <span style="color:#0000cf;font-weight:bold">29</span>       <span style="color:#0000cf;font-weight:bold">307200</span>          <span style="color:#0000cf;font-weight:bold">366</span>          <span style="color:#0000cf;font-weight:bold">266</span>          <span style="color:#0000cf;font-weight:bold">300</span>          <span style="color:#0000cf;font-weight:bold">100</span>           <span style="color:#0000cf;font-weight:bold">25</span>    <span style="color:#0000cf;font-weight:bold">4</span>   <span style="color:#0000cf;font-weight:bold">3</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">179</span>          <span style="color:#0000cf;font-weight:bold">180</span>           <span style="color:#0000cf;font-weight:bold">91</span>           <span style="color:#0000cf;font-weight:bold">21</span>
                <span style="color:#0000cf;font-weight:bold">3584</span>  <span style="color:#0000cf;font-weight:bold">30</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">188</span>          <span style="color:#0000cf;font-weight:bold">188</span>          <span style="color:#0000cf;font-weight:bold">200</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>    <span style="color:#0000cf;font-weight:bold">8</span>   <span style="color:#0000cf;font-weight:bold">7</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">179</span>          <span style="color:#0000cf;font-weight:bold">181</span>          <span style="color:#0000cf;font-weight:bold">180</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                <span style="color:#0000cf;font-weight:bold">4096</span>  <span style="color:#0000cf;font-weight:bold">31</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">169</span>          <span style="color:#0000cf;font-weight:bold">169</span>          <span style="color:#0000cf;font-weight:bold">401</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>    <span style="color:#0000cf;font-weight:bold">1</span>   <span style="color:#0000cf;font-weight:bold">1</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">160</span>          <span style="color:#0000cf;font-weight:bold">161</span>          <span style="color:#0000cf;font-weight:bold">169</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                <span style="color:#0000cf;font-weight:bold">5120</span>  <span style="color:#0000cf;font-weight:bold">32</span>        <span style="color:#0000cf;font-weight:bold">10240</span>          <span style="color:#0000cf;font-weight:bold">193</span>          <span style="color:#0000cf;font-weight:bold">191</span>          <span style="color:#0000cf;font-weight:bold">202</span>            <span style="color:#0000cf;font-weight:bold">2</span>            <span style="color:#0000cf;font-weight:bold">1</span>    <span style="color:#0000cf;font-weight:bold">4</span>   <span style="color:#0000cf;font-weight:bold">5</span> 0.500          <span style="color:#0000cf;font-weight:bold">182</span>          <span style="color:#0000cf;font-weight:bold">184</span>            <span style="color:#0000cf;font-weight:bold">3</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                <span style="color:#0000cf;font-weight:bold">6144</span>  <span style="color:#0000cf;font-weight:bold">33</span>         <span style="color:#0000cf;font-weight:bold">6144</span>          <span style="color:#0000cf;font-weight:bold">203</span>          <span style="color:#0000cf;font-weight:bold">202</span>          <span style="color:#0000cf;font-weight:bold">201</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">1</span>    <span style="color:#0000cf;font-weight:bold">2</span>   <span style="color:#0000cf;font-weight:bold">3</span> 0.500          <span style="color:#0000cf;font-weight:bold">193</span>          <span style="color:#0000cf;font-weight:bold">195</span>            <span style="color:#0000cf;font-weight:bold">6</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                <span style="color:#0000cf;font-weight:bold">7168</span>  <span style="color:#0000cf;font-weight:bold">34</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">208</span>          <span style="color:#0000cf;font-weight:bold">208</span>          <span style="color:#0000cf;font-weight:bold">200</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>    <span style="color:#0000cf;font-weight:bold">4</span>   <span style="color:#0000cf;font-weight:bold">7</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">199</span>          <span style="color:#0000cf;font-weight:bold">201</span>          <span style="color:#0000cf;font-weight:bold">201</span>            <span style="color:#0000cf;font-weight:bold">0</span>
                <span style="color:#0000cf;font-weight:bold">8192</span>  <span style="color:#0000cf;font-weight:bold">35</span>      <span style="color:#0000cf;font-weight:bold">1646592</span>          <span style="color:#0000cf;font-weight:bold">630</span>          <span style="color:#0000cf;font-weight:bold">429</span>          <span style="color:#0000cf;font-weight:bold">401</span>          <span style="color:#0000cf;font-weight:bold">201</span>          <span style="color:#0000cf;font-weight:bold">201</span>    <span style="color:#0000cf;font-weight:bold">1</span>   <span style="color:#0000cf;font-weight:bold">2</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">275</span>          <span style="color:#0000cf;font-weight:bold">200</span>          <span style="color:#0000cf;font-weight:bold">630</span>            <span style="color:#0000cf;font-weight:bold">0</span>
               <span style="color:#0000cf;font-weight:bold">10240</span>  <span style="color:#0000cf;font-weight:bold">36</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">143</span>          <span style="color:#0000cf;font-weight:bold">143</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>    <span style="color:#0000cf;font-weight:bold">2</span>   <span style="color:#0000cf;font-weight:bold">5</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">102</span>          <span style="color:#0000cf;font-weight:bold">104</span>            <span style="color:#0000cf;font-weight:bold">0</span>
               <span style="color:#0000cf;font-weight:bold">12288</span>  <span style="color:#0000cf;font-weight:bold">37</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">113</span>          <span style="color:#0000cf;font-weight:bold">113</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>    <span style="color:#0000cf;font-weight:bold">1</span>   <span style="color:#0000cf;font-weight:bold">3</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">102</span>          <span style="color:#0000cf;font-weight:bold">113</span>            <span style="color:#0000cf;font-weight:bold">0</span>
               <span style="color:#0000cf;font-weight:bold">14336</span>  <span style="color:#0000cf;font-weight:bold">38</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">113</span>          <span style="color:#0000cf;font-weight:bold">113</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">0</span>    <span style="color:#0000cf;font-weight:bold">2</span>   <span style="color:#0000cf;font-weight:bold">7</span> <span style="color:#0000cf;font-weight:bold">1</span>              <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">102</span>          <span style="color:#0000cf;font-weight:bold">104</span>            <span style="color:#0000cf;font-weight:bold">0</span>
large:          size ind    allocated      nmalloc      ndalloc    nrequests      curruns
               <span style="color:#0000cf;font-weight:bold">16384</span>  <span style="color:#0000cf;font-weight:bold">39</span>      <span style="color:#0000cf;font-weight:bold">3276800</span>          <span style="color:#0000cf;font-weight:bold">300</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">301</span>          <span style="color:#0000cf;font-weight:bold">200</span>
               <span style="color:#0000cf;font-weight:bold">20480</span>  <span style="color:#0000cf;font-weight:bold">40</span>        <span style="color:#0000cf;font-weight:bold">81920</span>          <span style="color:#0000cf;font-weight:bold">104</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">104</span>            <span style="color:#0000cf;font-weight:bold">4</span>
               <span style="color:#0000cf;font-weight:bold">24576</span>  <span style="color:#0000cf;font-weight:bold">41</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">0</span>
               <span style="color:#0000cf;font-weight:bold">28672</span>  <span style="color:#0000cf;font-weight:bold">42</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">0</span>
               <span style="color:#0000cf;font-weight:bold">32768</span>  <span style="color:#0000cf;font-weight:bold">43</span>        <span style="color:#0000cf;font-weight:bold">32768</span>          <span style="color:#0000cf;font-weight:bold">101</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">101</span>            <span style="color:#0000cf;font-weight:bold">1</span>
               <span style="color:#0000cf;font-weight:bold">40960</span>  <span style="color:#0000cf;font-weight:bold">44</span>        <span style="color:#0000cf;font-weight:bold">40960</span>         <span style="color:#0000cf;font-weight:bold">6829</span>         <span style="color:#0000cf;font-weight:bold">6828</span>         <span style="color:#0000cf;font-weight:bold">6829</span>            <span style="color:#0000cf;font-weight:bold">1</span>
               <span style="color:#0000cf;font-weight:bold">49152</span>  <span style="color:#0000cf;font-weight:bold">45</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">0</span>
               <span style="color:#0000cf;font-weight:bold">57344</span>  <span style="color:#0000cf;font-weight:bold">46</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">0</span>
               <span style="color:#0000cf;font-weight:bold">65536</span>  <span style="color:#0000cf;font-weight:bold">47</span>            <span style="color:#0000cf;font-weight:bold">0</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">100</span>            <span style="color:#0000cf;font-weight:bold">0</span>
               <span style="color:#0000cf;font-weight:bold">81920</span>  <span style="color:#0000cf;font-weight:bold">48</span>        <span style="color:#0000cf;font-weight:bold">81920</span>          <span style="color:#0000cf;font-weight:bold">101</span>          <span style="color:#0000cf;font-weight:bold">100</span>          <span style="color:#0000cf;font-weight:bold">101</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                     ---
              <span style="color:#0000cf;font-weight:bold">131072</span>  <span style="color:#0000cf;font-weight:bold">51</span>       <span style="color:#0000cf;font-weight:bold">131072</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                     ---
              <span style="color:#0000cf;font-weight:bold">327680</span>  <span style="color:#0000cf;font-weight:bold">56</span>       <span style="color:#0000cf;font-weight:bold">327680</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                     ---
             <span style="color:#0000cf;font-weight:bold">1048576</span>  <span style="color:#0000cf;font-weight:bold">63</span>      <span style="color:#0000cf;font-weight:bold">1048576</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">0</span>            <span style="color:#0000cf;font-weight:bold">1</span>            <span style="color:#0000cf;font-weight:bold">1</span>
                     ---
huge:           size ind    allocated      nmalloc      ndalloc    nrequests   curhchunks
                     ---
--- End jemalloc statistics ---</code></pre></div>
<h3 id="5-memory-purge">5. MEMORY PURGE</h3>

<p>请求分配器释放内存，同样只对jemalloc生效。手动进行回收内存(此命令会阻塞主进程)。命令效果如下，课件碎片的内存和碎片率都有所降低</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">127.0.0.1:7007&gt; info memory
<span style="color:#8f5902;font-style:italic"># Memory</span>
used_memory:13771144
used_memory_human:13.13M
used_memory_rss:27230208
used_memory_rss_human:25.97M
allocator_frag_ratio:1.11
allocator_frag_bytes:1492936
mem_fragmentation_ratio:1.98
mem_fragmentation_bytes:13500080
127.0.0.1:7007&gt; memory purge
OK
127.0.0.1:7007&gt; info memory
<span style="color:#8f5902;font-style:italic"># Memory</span>
used_memory:13771144
used_memory_human:13.13M
used_memory_rss:23994368
used_memory_rss_human:22.88M
allocator_frag_ratio:1.11
allocator_frag_bytes:1510856
mem_fragmentation_ratio:1.75
mem_fragmentation_bytes:10264240</code></pre></div>
    </div>
    <footer class="post-footer">
     

     <div class="post-nav">
    <div class="post-nav-next post-nav-item">
    
        <a href="http://www.shutdown.cn/post/redis4.0%E6%96%B0%E7%89%B9%E6%80%A7%E5%9B%9B-rdb-aof%E6%B7%B7%E5%90%88%E6%8C%81%E4%B9%85%E5%8C%96/" rel="next" title="">
        <i class="fa fa-chevron-left"></i> 
        </a>
    
    </div>

    <div class="post-nav-prev post-nav-item">
    
        <a href="http://www.shutdown.cn/post/redis4.0%E6%96%B0%E7%89%B9%E6%80%A7-redis-modules-system/" rel="prev" title="">
         <i class="fa fa-chevron-right"></i>
        </a>
    
    </div>
</div>
      
     
     
     






    </footer>
  </article>
</section>

          </div>
        </div>
        <div class="sidebar-toggle">
  <div class="sidebar-toggle-line-wrap">
    <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
    <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
    <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
  </div>
</div>
<aside id="sidebar" class="sidebar">
  <div class="sidebar-inner">

    <section class="site-overview sidebar-panel  sidebar-panel-active ">
      <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
        src="http://www.shutdown.cn/img/author.jpg"
        alt="不与天斗Domino" />
    <p class="site-author-name" itemprop="name">不与天斗Domino</p>
    <p class="site-description motion-element" itemprop="description"> 
        Programmer &amp; Architect</p>
</div>
      <nav class="site-state motion-element">
    <div class="site-state-item site-state-posts">
      <a href="http://www.shutdown.cn/post/">
        <span class="site-state-item-count">183</span>
        <span class="site-state-item-name">日志</span>
      </a>
    </div>
    <div class="site-state-item site-state-categories">    
        <a href="http://www.shutdown.cn/categories/">      
         
        <span class="site-state-item-count">15</span>
        
        <span class="site-state-item-name">分类</span>
        
        </a>
    </div>

    <div class="site-state-item site-state-tags">
        <a href="http://www.shutdown.cn/tags/">
         
        <span class="site-state-item-count">224</span>
        
        <span class="site-state-item-name">标签</span>
        </a>
    </div>
</nav>
      
      

      

      <div class="links-of-blogroll motion-element inline">
<script type="text/javascript" src="//rf.revolvermaps.com/0/0/8.js?i=&amp;m=0&amp;s=220&amp;c=ff0000&amp;cr1=ffffff&amp;f=arial&amp;l=33&amp;bv=35" async="async"></script>
</div>

    </section>
    
  </div>
</aside>

      </div>
    </main>
   
    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  <span itemprop="copyrightYear">  &copy; 
  2013 - 2023</span>
  <span class="with-love"><i class="fa fa-heart"></i></span>
  <span class="author" itemprop="copyrightHolder">天地维杰网</span>
  <span class="icp" itemprop="copyrightHolder"><a href="https://beian.miit.gov.cn/" target="_blank">京ICP备13019191号-1</a></span>
</div>
<div class="powered-by">
  Powered by - <a class="theme-link" href="http://gohugo.io" target="_blank" title="hugo" >Hugo v0.63.2</a>
</div>
<div class="theme-info">
  Theme by - <a class="theme-link" href="https://github.com/xtfly/hugo-theme-next" target="_blank"> NexT
  </a>
</div>


      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
      <span id="scrollpercent"><span>0</span>%</span>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/fastclick/lib/fastclick.min.js?v=1.0.6"></script> 
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/vendor/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="http://www.shutdown.cn/js/vendor/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>

<script src="http://www.shutdown.cn/js/vendor/fancybox/jquery.fancybox.pack.js?v=2.1.5"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/utils.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/motion.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/affix.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/schemes/pisces.js"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/scrollspy.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/post-details.js"></script>
<script type="text/javascript" src="http://www.shutdown.cn/js/toc.js"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/bootstrap.js"></script>

<script type="text/javascript" src="http://www.shutdown.cn/js/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
      inlineMath: [ ['$','$'] ],
      displayMath: [ ['$$','$$'] ],
      processEscapes: true
    },
    "HTML-CSS": { fonts: ["TeX"] }
  });
</script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML' async></script>
</body>
</html>